<%@ page language="java" import="java.util.*,com.css.vo.*" pageEncoding="UTF-8"%>
<%@ page import="com.css.dao.*,com.css.dao.impl.*"%>
<%@ page import="com.css.dao.*,com.css.action.*"%>
<%@ page import="com.css.dao.*,com.css.service.*"%>
<%@ page import="org.springframework.context.*,org.springframework.context.support.*"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>新增客户信息</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
  <header>
    <h1>新增客户信息</h1>
    <nav>
      <ul>
        <li><a href="index.jsp">首页</a></li>
        <li><a href="getList.action">系统管理</a></li>
        <li><a href="customer-management.jsp">客户信息管理</a></li>
        <li><a href="car-management.jsp">汽车信息管理</a></li>
        <li><a href="employee-management.jsp">员工信息管理</a></li>
        <li><a href="sales-management.jsp">销售信息管理</a></li>
      </ul>
    </nav>
  </header>
  <%
  	ApplicationContext myaApplicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
  	ICarService carService = (ICarService)myaApplicationContext.getBean("carService");
   %>

  <div class="content">
    <h2>请输入客户信息</h2>
    <form action="addCustomer.action" method="post">
      <table>
        <tr>
          <td><label for="customerName">姓名：</label></td>
          <td><input type="text" id="customer.customerName" name="customer.customerName" required></td>
        </tr>
        <tr>
          <td><label for="gender">性别：</label></td>
          <td><input type="text" id="customer.gender" name="customer.gender" required></td>
        </tr>
        <tr>
          <td><label for="birthDate">生日：</label></td>
          <td><input type="date" id="customer.birthDate" name="customer.birthDate" required></td>
        </tr>
        <tr>
          <td><label for="phone">电话：</label></td>
          <td><input type="text" id="customer.color" name="customer.phone" required></td>
        </tr>
        <tr>
          <td><label for="address">地址：</label></td>
          <td><input type="text" id="customer.address" name="customer.address" required></td>
        </tr>
        <tr>         
        <tr>
  		  <td><label for="intention">购车意向：</label></td>
		  <td>
		    <select id="customer.intention" name="customer.intention" required>
		      <option value="">请选择汽车</option>
		      <% 
		        List<Car> carList = carService.findAllCar();
		        for (Car car : carList) {
		      %>
		        <option value="<%= car.getCarId() %>"><%= car.getCarModel() + " " + car.getVersion() %></option>
		      <% 
		        }
		      %>
		    </select>
		  </td>
		</tr>
      </table>
      <br>
      <button type="submit">提交</button>
      <button type="reset">重置</button>
    </form>
  </div>
</body>
</html>
